package com.he.statemodel.context;

import com.he.statemodel.state.WorkState;

/**
 * 包含state接口的上下文，提供设置state接口的方法
 */
public class WorkContext {

    private int workHour;

    private boolean isFinished = false;

    private WorkState workState;

    public WorkContext(WorkState workState) {
        this.workState = workState;
    }

    public WorkState getWorkState() {
        return workState;
    }

    public void setWorkState(WorkState workState) {
        this.workState = workState;
    }

    public int getWorkHour() {
        return workHour;
    }

    public void setWorkHour(int workHour) {
        this.workHour = workHour;
    }

    public boolean isFinished() {
        return isFinished;
    }

    public void setFinished(boolean finished) {
        isFinished = finished;
    }


    public void workhandle() {
        workState.handle(this);
    }
}
